package com.alibaba.citrus.ots.unified.inventory.model.enums;

import org.apache.commons.lang3.StringUtils;

/**
 * @author wanwy
 * @description 货品组
 */
public enum GoodsGroupEnum {


    NORMAL_TEMPERATURE("1","常温"),
    low_temperature("2","低温");
    private String code;

    private String desc;

    GoodsGroupEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    /**
     * 通过code获取枚举
     *
     * @param code code
     * @return by code
     */
    public static GoodsGroupEnum getByCode(String code) {
        if (StringUtils.isBlank(code)) {
            return null;
        }
        for (GoodsGroupEnum goodsGroupEnum : values()) {
            if (StringUtils.equalsIgnoreCase(code, goodsGroupEnum.getCode())) {
                return goodsGroupEnum;
            }
        }
        return null;
    }
}
